#!/bin/bash
# 统计轨迹目录下产生定位的sim号码并去重排序,打包。
simpwd='/export/home/TrackFile'
simcount='/export/home/ttt/SimOnline'
hostip=`/sbin/ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk 'NR==1 { print $1}'`

#找出轨迹目录下产生定位的sim号码
find $simpwd -name "202112*.txt" |grep -v zip |awk 'BEGIN {FS="/"} {print $7$8$9}' > $simcount/$hostip-202112.txt
find $simpwd -name "202111*.txt" |grep -v zip |awk 'BEGIN {FS="/"} {print $7$8$9}' > $simcount/$hostip-202111.txt
find $simpwd -name "202110*.txt" |grep -v zip |awk 'BEGIN {FS="/"} {print $7$8$9}' > $simcount/$hostip-202110.txt
find $simpwd -name "202109*.txt" |grep -v zip |awk 'BEGIN {FS="/"} {print $7$8$9}' > $simcount/$hostip-202109.txt
find $simpwd -name "202108*.txt" |grep -v zip |awk 'BEGIN {FS="/"} {print $7$8$9}' > $simcount/$hostip-202108.txt
find $simpwd -name "202107*.txt" |grep -v zip |awk 'BEGIN {FS="/"} {print $7$8$9}' > $simcount/$hostip-202107.txt
find $simpwd -name "202106*.txt" |grep -v zip |awk 'BEGIN {FS="/"} {print $7$8$9}' > $simcount/$hostip-202106.txt
find $simpwd -name "202105*.txt" |grep -v zip |awk 'BEGIN {FS="/"} {print $7$8$9}' > $simcount/$hostip-202105.txt
find $simpwd -name "202104*.txt" |grep -v zip |awk 'BEGIN {FS="/"} {print $7$8$9}' > $simcount/$hostip-202104.txt
find $simpwd -name "202103*.txt" |grep -v zip |awk 'BEGIN {FS="/"} {print $7$8$9}' > $simcount/$hostip-202103.txt
find $simpwd -name "202102*.txt" |grep -v zip |awk 'BEGIN {FS="/"} {print $7$8$9}' > $simcount/$hostip-202102.txt
find $simpwd -name "202101*.txt" |grep -v zip |awk 'BEGIN {FS="/"} {print $7$8$9}' > $simcount/$hostip-202101.txt

#对号码进行排序并去重
/bin/sort $simcount/$hostip-202112.txt |/usr/bin/uniq > $simcount/$hostip-sim-202112.txt
/bin/sort $simcount/$hostip-202111.txt |/usr/bin/uniq > $simcount/$hostip-sim-202111.txt
/bin/sort $simcount/$hostip-202110.txt |/usr/bin/uniq > $simcount/$hostip-sim-202110.txt
/bin/sort $simcount/$hostip-202109.txt |/usr/bin/uniq > $simcount/$hostip-sim-202109.txt
/bin/sort $simcount/$hostip-202108.txt |/usr/bin/uniq > $simcount/$hostip-sim-202108.txt
/bin/sort $simcount/$hostip-202107.txt |/usr/bin/uniq > $simcount/$hostip-sim-202107.txt
/bin/sort $simcount/$hostip-202106.txt |/usr/bin/uniq > $simcount/$hostip-sim-202106.txt
/bin/sort $simcount/$hostip-202105.txt |/usr/bin/uniq > $simcount/$hostip-sim-202105.txt
/bin/sort $simcount/$hostip-202104.txt |/usr/bin/uniq > $simcount/$hostip-sim-202104.txt
/bin/sort $simcount/$hostip-202103.txt |/usr/bin/uniq > $simcount/$hostip-sim-202103.txt
/bin/sort $simcount/$hostip-202102.txt |/usr/bin/uniq > $simcount/$hostip-sim-202102.txt
/bin/sort $simcount/$hostip-202101.txt |/usr/bin/uniq > $simcount/$hostip-sim-202101.txt

#对目录文件进行打包压缩
/bin/tar -cvf $HOME/$hostip-sim.tar $simcount/*.txt
